package com.itheima.dubbo.mysql.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.commons.model.domain.lastYear;
import com.itheima.commons.model.domain.thisYear;
import com.itheima.dubbo.interfaces.CountInfoApi;
import com.itheima.dubbo.mysql.mapper.CountInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Service
public class CountInfoApiImpl implements CountInfoApi {
    @Autowired
    private CountInfoMapper countInfoMapper;

    @Override
    public Integer cumulativeUsers() {
        Integer count = countInfoMapper.cumulativeUsers();
        return count;
    }

    @Override
    public Integer activePassMonth(String start, String end) {
        Integer count = countInfoMapper.activePassMonth(start, end);
        return count;
    }

    @Override
    public Integer activePassWeek(String start, String end) {
        Integer count = countInfoMapper.activePassWeek(start, end);
        return count;
    }

    @Override
    public Integer newUsersToday(Date beginOfDay, Date endOfDay) {
        Integer count = countInfoMapper.newUsersToday(beginOfDay, endOfDay);
        return count;
    }

    @Override
    public Integer loginTimesToday(Date start, Date end) {
        Integer count = countInfoMapper.loginTimesToday(start, end);
        return count;
    }

    @Override
    public Integer activeUsersToday(Date start, Date end) {
        Integer count = countInfoMapper.activeUsersToday(start, end);
        return count;
    }

    @Override
    public Integer activeUsersYesterday(Date start, Date end) {
        Integer count = countInfoMapper.activeUsersYesterday(start, end);
        return count;
    }

    @Override
    public List<thisYear> queryEveryNewlyThisYear(String startDate, String endDate) {
        List<thisYear> thisYearList = countInfoMapper.queryEveryNewlyThisYear(startDate, endDate);
        return thisYearList;
    }

    @Override
    public List<lastYear> queryEveryNewlyLastYear(String startDate, String endDate) {
        List<lastYear> lastYearList = countInfoMapper.queryEveryNewlyLastYear(startDate, endDate);
        return lastYearList;
    }

    @Override
    public List<thisYear> queryEveryActiveThisYear(String startDate, String endDate) {
        List<thisYear> thisYearList = countInfoMapper.queryEveryActiveThisYear(startDate, endDate);
        return thisYearList;
    }

    @Override
    public List<lastYear> queryEveryActiveLastYear(String startDate, String endDate) {
        List<lastYear> lastYearList = countInfoMapper.queryEveryActiveLastYear(startDate, endDate);
        return lastYearList;
    }

    @Override
    public Integer queryActiveWithYesterdayNewly(Date todayStart, Date todayEnd, Date yesterdayStart, Date yesterdayEnd) {
        Integer count = countInfoMapper.queryActiveWithYesterdayNewly(todayStart, todayEnd, yesterdayStart, yesterdayEnd);
        return count;
    }

    @Override
    public Integer queryAddCount(String start, String end) {
        return countInfoMapper.queryAddCount(start,end);
    }

    @Override
    public Integer queryActiveCount(String start, String end) {
        return countInfoMapper.queryActiveCount(start,end);
    }
}
